﻿<ul class="menu">
@if((Model.Items as IEnumerable<dynamic>).Any())
{
    var tmp = new List<dynamic>();
    foreach(var i in Model.Items)
    {
        var t = (i.Translations as IEnumerable<dynamic>)
               .SingleOrDefault(x => JDM.Int32(x.Language.EntityID) ==
                   JDM.Int32(Svc.Localization.Language.EntityID));
        tmp.Add(new
        {
            Entity = i,
            Name = t != null ? JDM.String(t.Name) : JDM.String(i.EntityID)
        });
    }
    foreach(var i in tmp.OrderBy(x => x.Name))
    {
        <li><a href="@Url.Action(Loc.Act("Index").Ctrl("Item").Set(new
        {
            categoryID = JDM.Int32(i.Entity.EntityID)
        }).Localized())">@i.Name</a></li>
    }
}
else
{
    <li class="empty"><span>@T(Res.In("Common").Of("Expr").Name("NoData"))</span></li>
}
</ul>
